﻿using System;

class Bit_Ball
{
    static void Main()
    {
        int[,] grid = new int[8, 8];            // Filling the array with "0"

        // Console input for the Top team

        for (int row = 0; row < 8; row++)
        {
            int temp = int.Parse(Console.ReadLine());

            // Filling the array with "1" according to the binary representation of the number
            for (int col = 0; col < 8; col++)
            {
                if ((temp & (1 << col)) != 0)   // Check every bit if it is "1" or "0"
                {
                    grid[row, col] = 1;
                }
            }
        }

        // Console input for the Bottom team

        for (int row = 0; row < 8; row++)
        {
            int temp = int.Parse(Console.ReadLine());

            // Filling the array with "2" according to the binary representation of the number

            for (int col = 0; col < 8; col++)
            {
                if ((temp & (1 << col)) != 0)   // Check every bit if it is "1" or "0"
                {
                    if (grid[row, col] == 1)    // Check for a player from the Top team
                    {
                        grid[row, col] = 0;     // Cleaning the cell
                    }
                    else
                    {
                        grid[row, col] = 2;
                    }
                }
            }
        }

        int topScore = 0;
        int bottomScore = 0;

        // Calculating the score of the Top team

        for (int col = 0; col < 8; col++)            // Checking every cell in each column
        {
            for (int row = 7; row >= 0; row--)        // Searching for Top players
            {
                if (grid[row, col] == 1)            // The first player to be found is a Top one and a goal is scored
                {
                    topScore++;
                    break;
                }
                else if (grid[row, col] == 2)       // If a Bottom player is found before a Top one the search is stopped.
                {
                    break;
                }
            }
        }

        // Calculating the score of the Bottom team

        for (int col = 0; col < 8; col++)           // Checking every cell in each column
        {
            for (int row = 0; row < 8; row++)       // Searching for Bottom players
            {
                if (grid[row, col] == 2)            // The first player to be found is a Bottom one and a goal is scored
                {
                    bottomScore++;
                    break;
                }
                else if (grid[row, col] == 1)       // If a Top player is found before a Bottom one the search is stopped.
                {
                    break;
                }                                           
            }
        }

        Console.WriteLine("{0}:{1}", topScore, bottomScore);
    }
}
